﻿<UserControl x:Class="Hisaab.Windows.Client.View.RelateTransactionView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="314" d:DesignWidth="688">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition Height="250" />
            <RowDefinition Height="35" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="75" />
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="100" />
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="35" />
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="5*" />
            </Grid.ColumnDefinitions>

            <Label Grid.Column="0" VerticalContentAlignment="Center" >Account</Label>
            <ComboBox Grid.Column="1"
            ItemsSource="{Binding Path=Accounts}"
            SelectedValuePath="AccountId"
            SelectedValue="{Binding Path=SelectedAccount, Mode=TwoWay}" Style="{DynamicResource EditorComboBox}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>

            <Label Grid.Column="2" VerticalContentAlignment="Center" >Between Dates</Label>
            <DatePicker Grid.Column="3" SelectedDate="{Binding Path=StartDate, Mode=TwoWay}" Style="{DynamicResource EditorDatePicker}"/>
            <Label Grid.Column="4" VerticalContentAlignment="Center" >and</Label>
            <DatePicker Grid.Column="5" SelectedDate="{Binding Path=EndDate, Mode=TwoWay}" Style="{DynamicResource EditorDatePicker}"/>
            <Button Grid.Column="6" Command="{Binding QueryCommand}" Height="25">
                <Button.Content>
                    <Image Source="/Images/Small/Play.png" />
                </Button.Content>
            </Button>

        </Grid>

        <ListView Grid.Row="1" ItemsSource="{Binding Transactions}" SelectedItem="{Binding SelectedTransaction, Mode=TwoWay}"
                  SelectionMode="Single" HorizontalContentAlignment="Stretch" >
            <ListView.View>
                <GridView>
                    <GridViewColumn Width="100" Header="Date" DisplayMemberBinding="{Binding Date, StringFormat=d}" />
                    <GridViewColumn Width="450" Header="Title" DisplayMemberBinding="{Binding Title}" />
                    <GridViewColumn Width="100" Header="Amount" DisplayMemberBinding="{Binding Path=Amount, StringFormat='{}{0:C}'}"/>
                </GridView>
            </ListView.View>
        </ListView>
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="80"/>
                <ColumnDefinition Width="80"/>
            </Grid.ColumnDefinitions>
            <Button Grid.Column="1" Content="OK" Height="23" Width="75" Command="{Binding Path=OkCommand}" IsDefault="true" />
            <Button Grid.Column="2" Content="Cancel" Height="23" Width="75" Command="{Binding Path=CancelCommand}" IsCancel="true" />
        </Grid>
    </Grid>
</UserControl>